package velox.jcr.mapper;

import javax.jcr.RepositoryException;
import javax.jcr.Value;

public interface ValueMapper {
	public Object handle(Value value) throws RepositoryException, IllegalStateException;
	public String convert(Object object);
	
	public static ValueMapper STRING = new ValueMapper() {
		public String convert(Object object) {
			return (String) object;
		}

		public Object handle(Value value) throws RepositoryException, IllegalStateException {
			return value.getString();
		}
	};
}
